<template>
  <div class="main">
    <govheader
      title="化工产业大脑·智能制造诊断"
      @zfNameflagChange="zfNameflagChange"
    ></govheader>
    <govnavigation></govnavigation>
    <el-row
      class="content"
      style="margin: 0; position: relative"
      :gutter="20"
      v-if="zfNameflag"
    >
      <el-col :span="8" class="content-left">
        <el-col class="box">
          <div class="title">
            <p>区域等级分布</p>
          </div>
          <div class="content-body" style="margin-top: 3px">
            <div style="width: 100%; position: relative">
              <div
                v-show="echarts1ShowFlag"
                id="distribution"
                class="fl"
                style="width: 50%; height: 194px"
              ></div>
              <div
                v-show="echarts1ShowFlag"
                class="fl"
                style="width: 50%; height: 194px"
              >
                <div class="enterprise-body">
                  <div
                    class="enterprise-content"
                    v-for="(item, index) in optionData1"
                    :key="index"
                  >
                    <div
                      class="enterprise-color"
                      :style="{ background: item.itemStyle.color }"
                    ></div>
                    <div class="enterprise-type">{{ item.name }}</div>
                    <div class="enterprise-count">{{ item.pre }}</div>
                  </div>
                </div>
              </div>
              <div
                v-show="!echarts1ShowFlag"
                style="
                  width: 100%;
                  height: 194px;
                  color: #909399;
                  font-size: 14px;
                  text-align: center;
                  line-height: 194px;
                "
              >
                暂无数据
              </div>
            </div>
          </div>
        </el-col>
        <el-col class="box">
          <div class="title">
            <p>区域诊断数量</p>
          </div>
          <div class="box5 fl" style="width: 100%">
            <div style="position: relative">
              <div id="diagnosticQuantity" style="height: 230px"></div>
            </div>
          </div>
        </el-col>
        <el-col class="box" style="margin-bottom: 5px">
          <div class="title">
            <p>企业规模分布</p>
          </div>
          <div class="content-body" id="tableColor1" style="margin-top: 10px">
            <el-col :span="24">
              <div
                id="EnterpriseSizeIstribution"
                style="width: 60%; float: left; height: 200px"
              ></div>
              <div style="width: 40%; float: left; height: 200px">
                <div class="enterprise-body">
                  <div
                    class="enterprise-content"
                    v-for="(item, index) in myChart3Data"
                    :key="index"
                  >
                    <div
                      class="enterprise-color"
                      :style="{ background: item.itemStyle.color }"
                    ></div>
                    <div class="enterprise-type">{{ item.name }}</div>
                    <div class="enterprise-count">{{ item.pre }}</div>
                  </div>
                </div>
              </div>
            </el-col>
          </div>
        </el-col>
      </el-col>
      <el-col
        :span="8"
        class="content-center"
        style="background-color: (255, 255, 255, 0.5); position: relative"
      >
        <div>
          <div class="content-body" style="margin-top: 0px">
            <div
              class="box1"
              style="width: 48%; float: left; position: relative"
            >
              <p class="p2">
                <span>
                  <span>{{allTypetwo}}</span>
                  <i >个</i>
                </span>
              </p>
              <div class="box3"></div>
              <p class="p1">自诊断产业数量</p>
            </div>
            <div
              class="box2"
              style="width: 48%; float: left; position: relative"
            >
              <p class="p2">
                <span>
                  <span>{{lerverCountlist}}</span>
                  <i >个</i>
                </span>
              </p>
              <div class="box3"></div>
              <p class="p1">覆盖行业数</p>
            </div>
          </div>
        </div>
        <div style="overflow: hidden; margin-top: 20px; color: #ffffff">
          <i class="el-icon-location"></i
          ><span @click="zhejiang" :class="!locationname ? 'active' : ''">{{
            locationname ? "浙江省>" : "浙江省"
          }}</span>
          <span :class="locationname ? 'active' : ''"> {{ locationname }}</span>
          <el-select
            v-model="value"
            @change="change"
            placeholder="请选择行业"
            clearable
            style="float: right"
          >
            <el-option
              v-for="item in industryList"
              :key="item"
              :label="item"
              :value="item"
            >
            </el-option>
          </el-select>
        </div>
        <div id="Province" style="width: 100%; height: 480px"></div>
      </el-col>
      <el-col :span="8" class="content-right">
        <el-col class="box">
          <div class="title">
            <p>区域平均水平</p>
          </div>
          <div style="width: 100%; height: 207px">
            <div style="width: 100% !important; height: 100%; float: left">
              <div
                id="RegionalAverage"
                style="width: 100% !important; height: 100%"
              ></div>
            </div>
          </div>
        </el-col>
        <el-col class="box">
          <div class="title">
            <p>行业平均水平</p>
          </div>
          <div class="content-body" style="margin: 4px auto">
            <div id="industryAverage" style="width: 100%; height: 212px"></div>
          </div>
        </el-col>
        <div class="box" style="width: 100%; float: left; margin-bottom: 5px">
          <div class="title">
            <p>企业类型分布</p>
          </div>
          <div class="content-body" style="margin: 5px auto; height: 210px">
            <div
              id="BusinessTypeDistribution"
              style="width: 50%; height: 100%; float: left"
            ></div>
            <div style="width: 50%; height: 100%; float: left">
              <div class="enterprise-body">
                <div
                  class="enterprise-content"
                  v-for="(item, index) in option7Data"
                  :key="index"
                >
                  <div
                    class="enterprise-color"
                    :style="{ background: item.itemStyle.color }"
                  ></div>
                  <div class="enterprise-type">{{ item.name }}</div>
                  <div class="enterprise-count">{{ item.pre }}</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>
<script>
</script>
<script>
import { buriedPoint } from '@/utils/user'
const echarts = require("echarts");
import cityMap from "../js/china-main-city-map";
import dd from "gdt-jsapi";
import govheader from "@/components/govheader2";
import govnavigation from "@/components/govnavigation2";
import "echarts-gl";
export default {
  name: "zfIntelligentDiagnostic",
  components: { govheader, govnavigation },
  data() {
    return {
      zfNameflag: true,
      echarts1ShowFlag: true,
      locationname: "",
      colorList1: [
        "rgb(109,104,255)",
        "rgb(0,239,254)",
        "rgb(68,215,182)",
        "rgb(255,166,0)",
        "rgb(152,123,255)",
        "rgb(118,190,204)",
      ],
      colorList2: [
        "rgb(4,32,245)",
        "rgb(0,96,255)",
        "rgb(109,212,0)",
        "rgb(254,219,101)",
        "rgb(163,10,235)",
        "rgb(0,135,146)",
      ],
      myChart1: "",
      myChart2: "",
      myChart3: "",
      myChart4: "",
      myChart5: "",
      myChart6: "",
      myChart7: "",
      option1: "",
      option2: "",
      option3: "",
      option4: "",
      option5: "",
      option6: "",
      option7: "",
      center: {
        三门沿海化工: [
          121.665986,
          28.928485,
          "三门县沿海工业城化工集聚区",
          "4",
          "台州市三门县",
          "化学药品原料药制造",
          2.28,
        ],
        上虞经开: [
          120.816856,
          30.188745,
          "杭州湾上虞经济技术开发区",
          "98",
          "绍兴市杭州湾南岸",
          "基础化学原料制造",
          3.08,
        ],
      },

      option3xseries: [],
      optionData1: [],
      optionData2Data1: [],
      optionData2Data2: [],
      optionData6Data1: [],
      optionData6Data2: [],
      option7Data: [],
      myChart3Data: [],
      indexData: "",
      option5XData: "",
      option5Data: "",
      options: [
        {
          value: "选项1",
          label: "黄金糕",
        },
        {
          value: "选项2",
          label: "双皮奶",
        },
        {
          value: "选项3",
          label: "蚵仔煎",
        },
        {
          value: "选项4",
          label: "龙须面",
        },
        {
          value: "选项5",
          label: "北京烤鸭",
        },
      ],
      value: "",
      cityId: "330000",
      lerverCount: "",
      city:"",
      industry:"",
      typeOne:[],
      industryPriseScale:[],
      industryCount:{},
      lerverCountlist:'',
      industryAvgSco:[],
      companyKind:[],
      allTypeone:[],
     allTypetwo:"",
     industryList:[],
     countyNuber:[],
     companyNumber:[],
    };
  },
  created() {
    if (window.SITE_CONFIG["sitURL"] === "https://www.plantmate.com/api") {
      dd.getAuthCode({})
        .then((res) => {
          if (res) {
            let params = {
              applicationFlag: "20",
              authCode: res.auth_code,
            };
            this.$http
              .post(`/home/sys/loginfree/authentication`, params)
              .then(({ data: res }) => {
                console.log("res2:", res);
                this.$store.commit("zfName", res.data.lastName);
                localStorage.setItem('buriedPointInformation',JSON.stringify(res.data))
                if (res.code !== 0) {
                  this.zfNameflag = false;
                }
                buriedPoint('智能制造诊断')
              })
              .catch(() => {
                this.zfNameflag = false;
              });
          }
        })
        .catch(() => {
          this.zfNameflag = false;
        });
    }
  },

  mounted() {
    this.getDiagnosis()

  },
  beforeDestroy() {},

  methods: {
    // 计算数组所占百分比
    countPercentage(countArray) {
      let j = 0;
      countArray.forEach((i) => {
        j += i;
      });
      var resultArray = [];

      for (var i = 0; i < countArray.length; i++) {
         var k=''
        if((countArray[i] / j) * 100>0){
       k = ((countArray[i] / j) * 100).toFixed(2) + "%";
        }else{
        k='0%'
        }

        resultArray.push(k);
      }
      return resultArray;
    },
    zfNameflagChange(val) {
      this.zfNameflag = val;
    },
    getDiagnosis(){
      this.$http
      .post(`/home/government/govDiagnoseOverviewBusiness/getDiagnosis`, {
        city: this.city,
        industry: this.industry,
      })
      .then(({ data: res }) => {
        var lerverCountdata=[]
        var lerverCountdata2=[]
        var typeOnedata=[]
        var typeOnedata2=[]
        var industryPriseScaledata=[]
        var industryPriseScaledata2=[]
        var cityAvgScodata=[]
        var cityAvgScodata2=[]
        var industryAvgScodata=[]
        var industryAvgScodata2=[]
        var companyKinddata=[]
        var companyKinddata2=[]
        this.lerverCount = res.data.data.lerverCount;
        this.typeOne=res.data.data.typeOne
        this.industryCount=res.data.data.industryCount
        this.cityAvgSco=res.data.data.cityAvgSco
        this.industryAvgSco=res.data.data.industryAvgSco
        this.companyKind=res.data.data.companyKind
         this.industryPriseScale=res.data.data.industryPriseScale
         this.industryList=res.data.data.industryList
         this.allTypeone=res.data.data.allTypeone
         this.countyNuber=res.data.data.countyNuber
         this.companyNumber=res.data.data.companyNumber
         console.log(this.companyNumber);
        for (const key in this.lerverCount) {
           lerverCountdata.push(key)
           lerverCountdata2.push(this.lerverCount[key])
        }
        for (const key in this.companyKind) {
           companyKinddata.push(key)
           companyKinddata2.push(this.companyKind[key])
        }
        for (const key in this.industryAvgSco) {
          industryAvgScodata.push(key)
          industryAvgScodata2.push(this.industryAvgSco[key])
        }
        this.optionData6Data1=industryAvgScodata
        this.optionData6Data2=industryAvgScodata2
        for (const key in this.industryCount) {
            this.lerverCountlist=this.industryCount[key]
        }
        for (const key in this.allTypeone) {
            this.allTypetwo=this.allTypeone[key]
        }
        for (const key in this.typeOne) {
          typeOnedata.push(key)
          typeOnedata2.push(this.typeOne[key])
        }
        for (const key in this.industryPriseScale) {
          industryPriseScaledata.push(key)
          industryPriseScaledata2.push(this.industryPriseScale[key])
        }
        for (const key in this.cityAvgSco) {
           cityAvgScodata.push(key)
          cityAvgScodata2.push(this.cityAvgSco[key])
        }
        this.optionData1=lerverCountdata.map((y,index)=>{
           var obj={}
           obj.name=y
           obj.value=lerverCountdata2[index]
           return obj
        })
        this.myChart3Data=industryPriseScaledata.map((y,index)=>{
           var obj={}
           obj.name=y
           obj.value=industryPriseScaledata2[index]
           return obj
        })
          this.option5XData=cityAvgScodata
          this.option5Data=cityAvgScodata2
          this.optionData2Data1=typeOnedata
          this.optionData2Data2=typeOnedata2
          this.option7Data=companyKinddata.map((i,index)=>{
            var obj={}
            obj.name=i
            obj.value=companyKinddata2[index]
            return obj
          })
          this.getdistribution();
          this.getdiagnosticQuantity();
          this.getEnterpriseSizeIstribution();
          this.getRegionalAverage();
          this.getindustryAverage();
          this.getBusinessTypeDistribution();
          this.getProvince();

      })
      .catch(() => {});
    },
    getdistribution() {
      const that = this;
      let list = [];
      that.optionData1.forEach((i, index) => {
        i.itemStyle = {
          color: this.colorList1[index],
          color1: this.colorList2[index],
        };
        list.push(i.value);
      });
      that.optionData1.forEach((i, index) => {
        i.pre = this.countPercentage(list)[index];
      });
      if (
        this.myChart1 !== "" &&
        this.myChart1 !== null &&
        this.myChart1 !== undefined
      ) {
        this.myChart1.dispose();
      }
      this.myChart1 = echarts.init(document.getElementById("distribution"));
      var data = [];
      var data1 = [];

      var seriesOption = [
        // 最外层圆
        {
          type: "pie",
          radius: ["65%", "45%"],
          center: ["50%", "50%"],
          // hoverAnimation: false,
          data: [],
          label: {
            show: false,
            position: "outside",
            formatter: "{d}%",
            color: "#FFFFFF",
          },
          labelLine: {
            normal: {
              length: 80,
              lineStyle: {
                width: 1,
              },
            },
          },
        },
        // 内圆 + 中间文字
        {
          type: "pie",
          radius: ["50%", "30%"],
          center: ["50%", "50%"],
          // hoverAnimation: false,
          // z: 10,
          label: {
            show: false,
            position: "center",
            formatter: () => {
              return "佣金总额\r\n{total|100} 个";
            },
            rich: {
              total: {
                fontSize: 24,
                color: "#FFFFFF",
              },
            },
            color: "#FFFFFF",
            fontSize: 16,
            lineHeight: 30,
          },
          data: [],
          labelLine: {
            show: false,
          },
        },
      ];
      for (let i = 0; i < that.optionData1.length; i++) {
        data.push({
          value: that.optionData1[i].value,
          name: that.optionData1[i].name,
          itemStyle: {
            normal: {
              color: {
                // 完成的圆环的颜色
                colorStops: [
                  {
                    offset: 0,
                    color: that.optionData1[i].itemStyle.color1, // 0% 处的颜色
                  },
                  {
                    offset: 1,
                    color: that.optionData1[i].itemStyle.color, // 100% 处的颜色
                  },
                ],
              },
            },
          },
        });
        data1.push({
          value: that.optionData1[i].value,
          name: that.optionData1[i].name,
          itemStyle: {
            normal: {
              color: {
                // 完成的圆环的颜色
                colorStops: [
                  {
                    offset: 0,
                    color: that.optionData1[i].itemStyle.color1, // 0% 处的颜色
                  },
                  {
                    offset: 1,
                    color: that.optionData1[i].itemStyle.color, // 100% 处的颜色
                  },
                ],
              },
              opacity: 0.5,
            },
          },
        });
      }
      seriesOption[0].data = data;
      seriesOption[1].data = data1;

      this.option1 = {
        title: {
          text: "",
          top: 0,
          left: 0,
          textStyle: {
            width: "100%",
            color: "#52CCFF",
            fontSize: 14,
            fontWeight: 600,
          },
        },
        tooltip: {
          trigger: "item",
          confine: true,
          padding: [0, 5],
          backgroundColor: "rgba(0,0,0,.5)",
          extraCssText:
            "width:150px;color:#ffffff; white-space:pre-wrap;z-index: 100",
          formatter: function (params) {
            let percent = 0;
            let total = 0;
            for (let i = 0; i < that.optionData1.length; i++) {
              total += that.optionData1[i].value;
            }
            if( Number(((params.value / total) * 100).toFixed(0))>0){
                 percent = Number(((params.value / total) * 100).toFixed(0));
            }else{
                percent =0
            }

            if (params.name !== "") {
              return (
                params.name +
                " : " +
                params.value +
                "个,占比 : " +
                percent +
                "%"
              );
            } else {
              return "";
            }
          },
        },
        series: seriesOption,
      };
      this.myChart1.setOption(this.option1, true);
    },
    getdiagnosticQuantity() {
      const that = this;
      if (
        this.myChart2 !== "" &&
        this.myChart2 !== null &&
        this.myChart2 !== undefined
      ) {
        this.myChart2.dispose();
      }
      that.myChart2 = echarts.init(
        document.getElementById("diagnosticQuantity")
      );
      this.option2 = {
        animationDuration: 5000,

        tooltip: {
          trigger: "axis",
          // formatter: '{b} : {c}',
          axisPointer: {
            // 坐标轴指示器，坐标轴触发有效
            type: "shadow", // 默认为直线，可选为：'line' | 'shadow'
          },
          // extraCssText: "z-index: 9",
          // backgroundColor: "transparent",
          // borderWidth: 0,
          // padding: 0,
          // textStyle: {
          //   color: "#00E4FF",
          // },

          // formatter: function (res) {
          //   // let str = `<div style="position: relative;background-color:#ffffff;padding:5px">`
          //   // str +=
          //   //   '<div style="color:#909399;text-align: center;font-weight: 600">' +
          //   //   res[0].axisValue +
          //   //   '</div>' +
          //   //   '<div style="color:#909399;font-size:12px;"><span style="display:inline-block;width:100px;"> <div style="width: 10px;height: 10px;border-radius: 50%; background: ' +
          //   //   'linear-gradient(to right,' +
          //   //   res[0].color.colorStops[0].color +
          //   //   ', ' +
          //   //   res[0].color.colorStops[1].color +
          //   //   ');+' +
          //   //   '; margin-right: 5px;display: inline-block;"></div>' +
          //   //   res[0].seriesName +
          //   //   '</span><span style="display:inline-block;color:#303133">' +
          //   //   res[0].data +
          //   //   '</span></div>' +
          //   //   `</div>`
          //   // return str
          // },
        },
        // color: ["#13B9FB"],
        grid: {
          left: "5%",
          right: "6%",
          top: "10%",
          bottom: "5%",
          containLabel: true,
        },
        dataZoom: [
          {
            type: "inside",
            startValue: 0,
            endValue: 5,
            yAxisIndex: [0],
            zoomLock: true,
          },
        ],
        xAxis: {
          type: "value",
          name: "",
          axisLine: {
            // 这是y轴文字颜色
            lineStyle: {
              color: "#BFF7FF",
            },
          },
          splitLine: {
            show: true,
            lineStyle: {
              color: "rgba(255,255,255,0.3)",
            },
          },

          axisTick: {
            show: false,
          },
        },

        yAxis: [
          {
            type: "category",
            data: that.optionData2Data1,
            axisLine: {
              show: false,
              lineStyle: {
                color: "#BFF7FF",
              },
            },
            splitLine: {
              show: false,
            },
            axisTick: {
              show: false,
            },
          },
        ],
        series: [
          {
            name: "营收",
            type: "bar",
            label: {
              show: true,
              position: "right",
              color: "#ffffff",

              formatter: function (params) {
                return params.data;
              },
            },
            barWidth: 10,
            itemStyle: {
              color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
                { offset: 0, color: "#0570E9" },
                { offset: 1, color: "#0ECFF8" },
              ]),
              barBorderRadius: [20, 20, 20, 20],
            },

            data: that.optionData2Data2,
          },
        ],
      };
      this.myChart2.setOption(this.option2);
    },
    getRegionalAverage() {
      const that = this;
      if (
        this.myChart5 !== "" &&
        this.myChart5 !== null &&
        this.myChart5 !== undefined
      ) {
        this.myChart5.dispose();
      }
      that.myChart5 = echarts.init(document.getElementById("RegionalAverage"));
      this.option5 = {
        tooltip: {
          trigger: "item",
        },

        grid: {
          left: "0%",
          right: "0%",
          top: "15%",
          bottom: "10%",
          containLabel: true,
        },

        dataZoom: [
          {
            type: "inside",
            startValue: 0,
            endValue: 7,
            xAxisIndex: [0],
            zoomLock: true,
          },
        ],
        legend: {
          show: true,
          icon: "circle",
          orient: "horizontal",
          top: "90.5%",
          right: "center",
          itemWidth: 6.5,
          itemHeight: 6,
          textStyle: {
            fontSize: 14,
          },
        },
        xAxis: [
          {
            type: "category",
            data: this.option5XData,
            axisLabel: {
              textStyle: {
                color: "#FFFFFF",
                fontSize: 10,
              },
              interval: 0,
              margin: 20, // 刻度标签与轴线之间的距离。
            },
            axisLine: {
              show: false, // 不显示x轴
              lineStyle: {
                color: "#FFFFFF",
              },
            },
            axisTick: {
              show: false, // 不显示刻度
            },

            boundaryGap: true,
            splitLine: {
              // show: true,
              width: 0.08,
              lineStyle: {
                type: "solid",
                color: "#03202E",
              },
            },
          },
        ],
        yAxis: [
          {
            splitLine: {
              show: true,
              lineStyle: {
                color: "#2D5BAF",
                type: "solid",
              },
            },
            type: "value",
            name: "",
            axisTick: {
              show: false,
            },
            axisLine: {
              show: true,
              lineStyle: {
                color: "#2D5BAF",
              },
            },
            axisLabel: {
              textStyle: {
                color: "#FFFFFF",
              },
            },
          },
        ],
        series: [
          {
            // 柱底圆片
            name: "",
            type: "pictorialBar",
            symbolSize: [40, 14], // 调整截面形状
            symbolOffset: [0, 10],
            z: 6,
            itemStyle: {
              normal: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                  {
                    offset: 0,
                    color: "#00F4FF",
                  },
                  {
                    offset: 1,
                    color: "#0164A9",
                  },
                ]),
              },
            },
            data: this.option5Data,
          },

          // 柱体
          {
            name: "",
            type: "bar",
            barGap: "0%",
            barWidth: 40, // 柱体宽度
            itemStyle: {
              normal: {
                color: {
                  x: 0,
                  y: 0,
                  x2: 0,
                  y2: 1,
                  type: "linear",
                  global: false,
                  colorStops: [
                    {
                      // 第一节下面
                      offset: 0,
                      color: "#0164A9",
                    },
                    {
                      offset: 1,
                      color: "#0164A9",
                    },
                  ],
                },
              },
            },

            data: this.option5Data,
          },

          // 柱顶圆片
          {
            name: "",
            type: "pictorialBar",
            symbolSize: [40, 14], // 调整截面形状[宽, 高]
            symbolOffset: [0, -10],
            z: 6,
            symbolPosition: "end",
            itemStyle: {
              normal: {
                color: new echarts.graphic.LinearGradient(
                  0,
                  0,
                  0,
                  1,
                  [
                    {
                      offset: 0,
                      color: "#00F4FF",
                    },
                    {
                      offset: 1,
                      color: "#0164A9",
                    },
                  ],
                  false
                ),
              },
            },
            data: this.option5Data,
          },
        ],
      };
      this.myChart5.setOption(this.option5);
    },
    getProvince() {
      this.companyNumber.forEach((i)=>{
         i.name=i.city
      })
      const that = this;
      if (
        this.myChart4 !== "" &&
        this.myChart4 !== null &&
        this.myChart4 !== undefined
      ) {
        this.myChart4.dispose();
      }

      that.myChart4 = echarts.init(document.getElementById("Province"));
      let name = require("../json/" + that.cityId + ".json");
      let scatterData1 = [];
      scatterData1=this.companyNumber
      echarts.registerMap("name", name);
      this.option4 = {
        tooltip: {
          trigger: "item",
          extraCssText: "z-index: 9",
          backgroundColor: null,
          borderColor: "#333",
          borderWidth: 0,
          padding: 0,
          textStyle: {
            color: "#ffffff",
          },
          formatter: function (para) {
            // console.log(para);
           if (para.seriesType === 'map'&& para.data) {
              let str = `<div style="position: relative;border:1px solid #00d3e7;background-color:rgba(10, 39, 116, .5)">
                <div style="width: 10px;height: 10px;position:absolute;border-top: 3px solid #00d3e7;border-left: 3px solid #00d3e7;left: -3px;top: -3px; "></div>
                <div style="width: 10px;height: 10px;position:absolute;border-top: 3px solid #00d3e7;border-right: 3px solid #00d3e7;right: -3px;top: -3px;"></div>
                <div style="width: 10px;height: 10px;position:absolute;border-bottom:3px solid #00d3e7;border-right: 3px solid #00d3e7;right: -3px;bottom: -3px;"></div>
                <div style="width: 10px;height: 10px;position:absolute;border-bottom:3px solid #00d3e7;border-left: 3px solid #00d3e7;left: -3px;bottom: -3px;"></div>`
                str +=
                '<div  style=" font-size: 12px;"><span style="color:#E4E4E4;     font-size: 12px;display: inline-block; width: 80px;">&nbsp;'+para.data.name+'企业数量</span>&nbsp;&nbsp;&nbsp;  <span  style=" padding-left: 5px;  margin-right: 10px;  color: #00E4FF !important;" >' +
                para.data.number +
                '</span></div></div></div>'
              return str
            } else {
              return ''
            }
          },
        },
        geo: [
          {
            map: "name",
            aspectScale: 0.9,
            roam: true, // 是否允许缩放
            layoutSize: "100%",
            layoutCenter: ["50%", "50%"],
            zoom: 1,
            itemStyle: {
              areaColor: "#030673",
              borderColor: "#0078FF",
              borderWidth: 1,
            },
            emphasis: {
              itemStyle: {
                areaColor: "#0078FF",
              },
              label: {
                show: true,
                color: "#AAECFF",
              },
            },
            label: {
              show: true,
              color: "#AAECFF",
            },
            zlevel: 3,
          },
        ],
        series: [
          {
            type: "map",
            coordinateSystem: "geo",
            geoIndex: 0,
            symbol: "circle",
            symbolSize: 6,
            showEffectOn: "render",
            rippleEffect: {
              brushType: "fill",
              scale: 3,
            },
            hoverAnimation: true,
            itemStyle: {
              color: "rgb(0, 141, 221)",
            },
            label: {
              formatter: function (para) {
                return "";
              },
            },
            emphasis: {
              label: {
                show: true,
              },
              itemStyle: {
                color: "rgb(255, 155, 55)",
                borderColor: "rgb(255, 155, 55)",
                borderWidth: 6,
              },
            },

            data: scatterData1,
            zlevel: 10,
          },
        ],
      };
      this.myChart4.setOption(this.option4, true);
      this.myChart4.on("click", function (param) {
        var cityId = cityMap[param.name];
        if (that.locationname) {
        } else {
          that.locationname = param.name;
        }
        if(cityId){
        that.cityId = cityId;
        that.getProvincedata();
        that.city=param.name
        that.getDiagnosis()
       }
      });
    },
    getProvincedata() {
      const that = this;
      let name = require("../json/" + this.cityId + ".json");
      echarts.registerMap("name", name);
      that.option4.geo.map = "name";
      that.myChart4.setOption(that.option4, true);
    },
    zhejiang() {
      const that = this;
      this.cityId = "330000";
      this.city=''
      that.locationname = "";
      that.getProvincedata();
        this.getDiagnosis()
    },
    change(el) {
      console.log(el);
      this.industry=el
      this.getDiagnosis()
    },
    getindustryAverage() {
      const that = this;

      if (
        this.myChart6 !== "" &&
        this.myChart6 !== null &&
        this.myChart6 !== undefined
      ) {
        this.myChart6.dispose();
      }
      this.myChart6 = echarts.init(document.getElementById("industryAverage"));
      this.option6 = {
        animationDuration: 5000,
        tooltip: {
          trigger: "axis",
          // formatter: '{b} : {c}',
          axisPointer: {
            // 坐标轴指示器，坐标轴触发有效
            type: "shadow", // 默认为直线，可选为：'line' | 'shadow'
          },
          // extraCssText: "z-index: 9",
          // backgroundColor: "transparent",
          // borderWidth: 0,
          // padding: 0,
          // textStyle: {
          //   color: "#00E4FF",
          // },

          // formatter: function (res) {
          //   // let str = `<div style="position: relative;background-color:#ffffff;padding:5px">`
          //   // str +=
          //   //   '<div style="color:#909399;text-align: center;font-weight: 600">' +
          //   //   res[0].axisValue +
          //   //   '</div>' +
          //   //   '<div style="color:#909399;font-size:12px;"><span style="display:inline-block;width:100px;"> <div style="width: 10px;height: 10px;border-radius: 50%; background: ' +
          //   //   'linear-gradient(to right,' +
          //   //   res[0].color.colorStops[0].color +
          //   //   ', ' +
          //   //   res[0].color.colorStops[1].color +
          //   //   ');+' +
          //   //   '; margin-right: 5px;display: inline-block;"></div>' +
          //   //   res[0].seriesName +
          //   //   '</span><span style="display:inline-block;color:#303133">' +
          //   //   res[0].data +
          //   //   '</span></div>' +
          //   //   `</div>`
          //   // return str
          // },
        },
        // color: ["#13B9FB"],
        grid: {
          left: "5%",
          right: "6%",
          top: "10%",
          bottom: "5%",
          containLabel: true,
        },
        dataZoom: [
          {
            type: "inside",
            startValue: 0,
            endValue: 5,
            yAxisIndex: [0],
            zoomLock: true,
          },
        ],
        xAxis: {
          type: "value",
          name: "",
          axisLine: {
            // 这是y轴文字颜色
            lineStyle: {
              color: "#BFF7FF",
            },
          },
          splitLine: {
            show: true,
            lineStyle: {
              color: "rgba(255,255,255,0.3)",
            },
          },

          axisTick: {
            show: false,
          },
        },

        yAxis: [
          {
            type: "category",
            data: that.optionData6Data1,
            axisLine: {
              show: false,
              lineStyle: {
                color: "#BFF7FF",
              },
            },
            splitLine: {
              show: false,
            },
            axisTick: {
              show: false,
            },
          },
        ],
        series: [
          {
            name: "营收",
            type: "bar",
            label: {
              show: true,
              position: "right",
              color: "#ffffff",

              formatter: function (params) {
                return params.data;
              },
            },
            barWidth: 10,
            itemStyle: {
              color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
                { offset: 0, color: "#32D5A5" },
                { offset: 1, color: "rgba(2, 198, 255, 0)" },
              ]),
              // barBorderRadius: [20, 20, 20, 20],
            },

            data: that.optionData6Data2,
          },
        ],
      };
      this.myChart6.setOption(this.option6);
    },
    getBusinessTypeDistribution() {

      let list = [];
      this.option7Data.forEach((i, index) => {
        i.itemStyle = {
          color: this.colorList1[index],
          color1: this.colorList2[index],
        };
        list.push(i.value);
      });
      this.option7Data.forEach((i, index) => {
        i.pre = this.countPercentage(list)[index];
        return i;
      });

      if (
        this.myChart7 !== "" &&
        this.myChart7 !== null &&
        this.myChart7 !== undefined
      ) {
        this.myChart7.dispose();
      }
      this.myChart7 = echarts.init(
        document.getElementById("BusinessTypeDistribution")
      );
      this.option7 = {
        tooltip: {
          show: true,
          trigger: "item",
          confine: true,
          extraCssText: "z-index: 100",
        },
        color: [
          "#00FFFF",
          "#0572EA",
          "#6BD59F",
          "#EAE87A",
          "#FFCD5E",
          "#AE42EA",
          "#FFCD5E",
          "#AE42EA",
        ],
        series: [
          {
            data: this.option7Data,

            type: "pie",
            radius: [30, 80],
            center: ["40%", "50%"],
            roseType: "area",
            label: {
              // 标识
              normal: {
                show: false,
                // position: 'center',
                formatter: "{d}%\n{b}",
              },
            },
            labelLine: {
              normal: {
                show: false,
              },
            },
          },
        ],
      };
      this.myChart7.setOption(this.option7);
    },
    getEnterpriseSizeIstribution() {
      const that = this;
      var list = [];
      var isshow=false
     if (
        this.myChart3 !== '' &&
        this.myChart3 !== null &&
        this.myChart3 !== undefined
      ) {
        this.myChart3.dispose()
      }
        this.myChart3Data.forEach((i,)=>{
          var value =i.value
          var value2= value*10
          i.value=value2
          isshow=true
          // console.log(value);
      })
      this.myChart3 = echarts.init(
        document.getElementById("EnterpriseSizeIstribution")
      );
      var img =
        "";

      var data = [];
      // console.log( this.myChart3Data);
      for (var i = 0; i < this.myChart3Data.length; i++) {
        data.push(
          {
            value: this.myChart3Data[i].value,
            name: this.myChart3Data[i].name,
            itemStyle: {
              borderWidth: 5,
              shadowBlur: 20,
              borderColor: this.colorList1[i],
              shadowColor: this.colorList2[i],
            },
          },
          {
            value: 2,
            name: "",
            itemStyle: {
              normal: {
                label: {
                  show: false,
                },
                labelLine: {
                  show: false,
                },
                color: "rgba(0, 0, 0, 0)",
                borderColor: "rgba(0, 0, 0, 0)",
                borderWidth: 0,
              },
            },
          }
        );
        list.push(this.myChart3Data[i].value);
      }
      this.myChart3Data.forEach((i, index) => {
        i.pre = this.countPercentage(list)[index];
        i.itemStyle = {
          color: this.colorList1[index],
          color1: this.colorList2[index],
        };
      });

      //  console.log( this.myChart3Data);
      var seriesOption = [
        {
          name: "",
          type: "pie",
          clockWise: false,
          radius: [55, 55],
          hoverAnimation: false,
          itemStyle: {
            normal: {
              label: {
                show: true,
                position: "outside",
                color: "#ddd",
                formatter: function (params) {},
              },
              labelLine: {
                length: 10,
                length2: 10,
                show: true,
                color: "#00ffff",
              },
            },
          },
          data: data,
        },
      ];
      this.option3 = {
        title: {
          text: "",
          top: "48%",
          textAlign: "center",
          left: "49%",
          textStyle: {
            color: "#fff",
            fontSize: 22,
            fontWeight: "400",
          },
        },
        graphic: {
          elements: [
            {
              type: "image",
              z: 3,
              style: {
                image: img,
                width: 90,
                height: 90,
              },
              left: "center",
              top: "center",
              position: [100, 100],
            },
          ],
        },
        tooltip: {
          show: true,
              trigger: "item",
          extraCssText: "z-index: 9",
          backgroundColor: null,
          borderColor: "#333",
          borderWidth: 0,
          padding: 0,
          textStyle: {
            color: "#ffffff",
          },
          formatter: function (para) {
            console.log(para);
          //  if (para.seriesType === 'map'&& para.data) {
              let str = `<div style="position: relative;border:1px solid #00d3e7;background-color:rgba(10, 39, 116, .5)">
                <div style="width: 10px;height: 10px;position:absolute;border-top: 3px solid #00d3e7;border-left: 3px solid #00d3e7;left: -3px;top: -3px; "></div>
                <div style="width: 10px;height: 10px;position:absolute;border-top: 3px solid #00d3e7;border-right: 3px solid #00d3e7;right: -3px;top: -3px;"></div>
                <div style="width: 10px;height: 10px;position:absolute;border-bottom:3px solid #00d3e7;border-right: 3px solid #00d3e7;right: -3px;bottom: -3px;"></div>
                <div style="width: 10px;height: 10px;position:absolute;border-bottom:3px solid #00d3e7;border-left: 3px solid #00d3e7;left: -3px;bottom: -3px;"></div>`
                str +=
                '<div  style=" font-size: 12px;"><span style="color:#E4E4E4;   font-size: 12px;display: inline-block; width: 80px;">&nbsp;'+para.data.name+'企业数量</span>&nbsp;&nbsp;&nbsp;  <span  style=" padding-left: 5px;    margin-left: 10px; margin-right: 10px; color: #00E4FF !important;" >' +
                para.data.value/10 +
                '</span></div></div></div>'
              return str

          },
        },

        toolbox: {
          show: false,
        },
        series: seriesOption,
      };
      this.myChart3.setOption(this.option3);
    },
  },
};
</script>
<style lang="scss" scoped>
.main {
  background-size: 100% 100%;
  background: #041565;
}

.box {
  padding-top: 10px;
  margin-bottom: 20px;
  overflow: hidden;
  background-image: url("../../../../assets/img/industry/框尺寸1.png");
  background-size: 100% 100%;
}

.content {
  padding: 15px 0 0; //（上15px；左、右0px；下0px。）
}
.content-body {
  padding: 5px;
  margin-top: 5px;
  overflow: hidden;
  > div {
    float: left;
    overflow: hidden;
  }
  .content-body-left {
    width: 44%;
  }
  .content-body-right {
    width: 56%;
  }
}
//滚动条的宽度
.main ::-webkit-scrollbar {
  /*滚动条整体样式*/
  width: 10px; /*高宽分别对应横竖滚动条的尺寸*/
  height: 1px;
  display: none;
}
.main ::-webkit-scrollbar-thumb {
  /*滚动条里面小方块*/
  border-radius: 10px;
  background: rgba(0, 90, 255, 0);
}
.main ::-webkit-scrollbar-track {
  /*滚动条里面轨道*/
  -webkit-box-shadow: inset 0 0 5px rgba(0, 90, 255, 0);
  border-radius: 10px;
  background: #ededed;
}

.title {
  width: 270px;
  margin-left: 10px;
  font-weight: 700;
  font-size: 14px;
  background-image: url("../../../../assets/img/industry/小标题背景1.png");
  background-size: 100% 100%;
  color: #ffffff;

  p {
    padding-left: 26px;
    font-size: 12px;
  }
}
.fl {
  float: left;
}

.fr {
  float: right;
}
.box1 {
  width: 256px;
  height: 206px;
  background-image: url("../../../../assets/img/industry/hynumber.png");
  background-size: 100% 100%;
  position: relative;
}
.box3 {
  width: 40%;
  height: 40%;
  background-image: url("../../../../assets/img/industry/bg-date.png");
  background-size: 100% 100%;
  margin: 20px auto;
  margin-top: 50px;
}
.p1 {
  color: #ffffff;
  height: 20px;
  text-align: center;
  font-style: 16px;
}
.p2 {
  color: #ffffff;
  text-align: center;
  margin-top: 30px;
  font-size: 30px;
  font-family: Impact;
  font-weight: 400;
  font-style: italic;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 30px auto;
  & > span {
    width: 42%;
    display: inline-block;
    margin: 0 auto;
    & > span {
      margin-right: 10px;
      margin-left: 10px;
    }
  }
}
.box2 {
  width: 256px;
  height: 206px;
  background-image: url("../../../../assets/img/industry/hynumber.png");
  background-size: 100% 100%;
  margin-left: 18px;
}
.enterprise-body {
  float: left;
  width: 100%;
  height: 200px;
  padding: 25px 5px;
  color: #ffffff;
}
.enterprise-content {
  width: 100%;
  height: 30px;
  padding: 0px 5px;
}
.enterprise-color {
  width: 10px;
  height: 10px;
  margin-top: 10px;
  float: left;
}
.enterprise-type {
  font-size: 13px;
  // color: #ffffff;
  line-height: 30px;
  float: left;
  margin-left: 12px;
}
.enterprise-count {
  font-size: 14px;
  line-height: 30px;
  float: right;
}
.el-top {
  margin: 0 5px;
  background-image: url("../../../../assets/img/industry/up@3x.png");
  background-size: 100% 100%;
  display: inline-block;
  width: 12px;
  height: 23px;
}
.el-bottom {
  margin: 0 5px;
  background-image: url("../../../../assets/img/industry/down@3x.png");
  background-size: 100% 100%;
  display: inline-block;
  width: 12px;
  height: 23px;
}
/deep/ .el-icon-location {
  color: #00e4ff;
  display: inline-block;
  line-height: 30px;
  margin-right: 5px;
}
/deep/.el-input__inner {
  background: #1f4987;
  border: 1px solid #3573fc;
  opacity: 0.57;
  height: 30px;
  line-height: 30px;
  color: #ffffff;
}
/deep/.el-input__icon {
  line-height: 30px;
}
/deep/ .el-icon-arrow-up {
  color: #3573fc !important;
}
.active {
  cursor: pointer;
  color: #eebf43;
}
</style>
